﻿Public Class Packets

    Public Sub ReceivePacket(ByVal bite() As Byte)

        Dim msg As String = String.Empty

        For Each b As Byte In bite
            If Not b = 0 Then
                msg += Convert.ToChar(b)
            Else
                Exit For
            End If
        Next

        Console.WriteLine(msg.Trim)

    End Sub

    Public Sub SendPacket(ByVal Send() As Char, client As System.Net.Sockets.NetworkStream)
        Dim msg(Send.Length - 1) As Byte
        Dim i As Integer = 0

        For Each b As Char In Send
            msg(i) = Convert.ToByte(b)
            i += 1
        Next

        client.Write(msg, 0, Send.Length)

    End Sub

End Class
